﻿using System.Collections.Generic;
using System.Linq;

namespace CatalogModel.Codelists
{
	public class GeometricIndustryStandard : ICodelist
	{
		public GeometricIndustryStandard()
		{
		}

		public GeometricIndustryStandard(string codelistNumber, string shortDescription, string longDescription, string sortOrder)
		{
			CodelistNumber = int.Parse(codelistNumber);
			ShortDescription = shortDescription;
			LongDescription = longDescription;
			SortOrder = int.Parse(sortOrder);
		}

		public int ID { get; set; }
		public int CodelistNumber { get; set; }

		public string ShortDescription { get; set; }
		public string LongDescription { get; set; }
		public int? SortOrder { get; set; }

		public virtual GeometricIndustryPractice GeometricIndustryPractice { get; set; }

		public string Name { get; } = "GeometricIndustryStandard";

		public ICodelist Parent
		{
			get { return GeometricIndustryPractice; }
			set { GeometricIndustryPractice = (GeometricIndustryPractice)value; }
		}

		public List<ICodelist> Childs
		{
			get { return null; }
		}
	}

	public class GeometricIndustryPractice : ICodelist, ICodelistCategory	
	{
		public GeometricIndustryPractice()
		{
		}

		public GeometricIndustryPractice(string codelistNumber, string shortDescription, string longDescription, string sortOrder)
		{
			CodelistNumber = int.Parse(codelistNumber);
			ShortDescription = shortDescription;
			LongDescription = longDescription;
			SortOrder = int.Parse(sortOrder);
		}

		public int ID { get; set; }
		public int CodelistNumber { get; set; }

		public string ShortDescription { get; set; }
		public string LongDescription { get; set; }
		public int? SortOrder { get; set; }

		public virtual List<GeometricIndustryStandard> GeometricIndustryStandards { get; set; }

		public string Name { get; } = "GeometricIndustryPractice";

		public ICodelist Parent
		{
			get { return null; }
			set { }
		}

		public List<ICodelist> Childs
		{
			get { return GeometricIndustryStandards.ToList<ICodelist>(); }
		}

		public void AddChild(ICodelist child)
		{
			if (GeometricIndustryStandards == null)
				GeometricIndustryStandards = new List<GeometricIndustryStandard>();
			GeometricIndustryStandards.Add((GeometricIndustryStandard)child);
		}
	}
}
